from .base import BasePage
from .locators import USERNAME_INPUT, SUBMIT_BUTTON
from .pc_locators import PC_USERNAME_INPUT, PC_PASSWORD_INPUT, PC_CAPTCHA_INPUT, PC_SUBMIT_BUTTON
from selenium.webdriver.common.by import By

class LoginPage(BasePage):
    def __init__(self, driver):
        super().__init__(driver)

    # 输入班牌的设备编号
    def enter_username(self, username):
        self.enter_text(By.XPATH, USERNAME_INPUT, username)

    # 点击班牌的【进入设备】按钮
    def click_submit(self):
        self.click_element(By.XPATH, SUBMIT_BUTTON)

    # 输入PC端的用户名
    def pc_enter_username(self, username):
        self.enter_text(By.XPATH, PC_USERNAME_INPUT, username)

    # 输入PC端的密码
    def pc_enter_password(self, password):
        self.enter_text(By.XPATH, PC_PASSWORD_INPUT, password)

    # 输入PC端的验证码
    def enter_captcha(self, captcha):
        self.enter_text(By.XPATH, PC_CAPTCHA_INPUT, captcha)

    # 点击PC端的【登录】按钮
    def pc_click_submit(self):
        self.click_element(By.XPATH, PC_SUBMIT_BUTTON)



